package runthrad.callbacklist;

import javax.xml.bind.DatatypeConverter;

/**
 * 定义被回调的类，用于响应回调发生的处理事件
 *
 * @author lianmingzhang
 * @create 2017-09-21 下午8:58
 *
 */
public class Slave1 implements Callback {
    private String filename;
    private byte[] digest;


    @Override
    public void doEvent(String filename, byte[] digest) {
        this.digest = digest;
        this.filename = filename;
        System.out.println(this);
    }

    @Override
    public String toString() {
        String result = filename + ": ";
        if(digest != null) {
            result += DatatypeConverter.printHexBinary(digest);
        } else {
            result += "digest not avilable";
        }
        return result;
    }
}
